package nl.haemers.form.rules 
{
	/**
	 * ...
	 * @author Jonathan Haemers
	 */
	public class EmailRule implements IRule
	{
		protected var _regEx				:RegExp;
		
		public function EmailRule() 
		{
			_regEx = /^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*+@((\w|-)+\.)+\w{2,4}+/i;
		}
		
		public function validate(value:String) : Boolean
		{
			return _regEx.test(value);
		}
		
		/** Getters & Setters **/		
		public function get regEx():RegExp { return _regEx; }
		
		public function set regEx(value:RegExp):void 
		{
			_regEx = value;
		}
		
	}

}